// Package api
// @Title api[简述该包的主要作用]
// @Description
// @Author  cnHuaShao
// @since v0.0.1
// @Version v1.0.0
// @Date 2024/6/4 22:29
// @Update 2024/6/4 22:29
package api

import (
	"FinancialManagement/src/base/mess"
	"FinancialManagement/src/base/util"
	"FinancialManagement/src/business/inventory"
	"github.com/gin-gonic/gin"
	"net/http"
)

// GetInventoryList
// @Description: 获取库存列表信息
// @param c
func GetInventoryList(c *gin.Context) {
	typeName := c.DefaultPostForm("typeName", "")                  // 查询条件
	pageSize := util.ToInt(c.DefaultPostForm("pageSize", "10"))    // 显示行数
	pageNumber := util.ToInt(c.DefaultPostForm("pageNumber", "1")) // 当前页
	customerList, count, err := inventory.GetInventoryList(typeName, pageSize, pageNumber)
	if err != nil {
		c.JSON(http.StatusOK, mess.ResErrMess(910005011, err.Error()))
		return
	}
	c.JSON(http.StatusOK, mess.ResMessOK(gin.H{
		"list":  customerList,
		"count": count,
	}))
}
